<?php
	$style = '';
	if ( count($this->data[0]) > 0) {
	    for ($i=0; $i < count($this->data); $i++) {

	    	$thumb_box_width = ($_SESSION['rwcards']['config']['rwcards_thumb_box_width'] != "" ) ? $_SESSION['rwcards']['config']['rwcards_thumb_box_width'] : '260';
	    	$thumb_box_height = $_SESSION['rwcards']['config']['rwcards_thumb_box_height'] ? $_SESSION['rwcards']['config']['rwcards_thumb_box_height'] : '220';
	        $style .="
#myGallery_rwcards_".$i."
{
	width: " . $thumb_box_width . "px !important;
	height: " . $thumb_box_height . "px !important;
	border: 1px solid #000;
}

#myGallery_rwcards_".$i." img.thumbnail
{
	display: none;
}
#rwcardsTable
{
	width:100%;
	border:0px;
	padding:1em;
	border:1px solid black;
	margin:2px;
}
.slideshow{
	width: " . $thumb_box_width . "px !important;
}
.slideshow-captions{
	width: " . $thumb_box_width . "px !important;
}
";
	    }
	  }

echo "<style>$style</style>";

	if ( count($this->data[0]) > 0) {
	    for ($i=0; $i < count($this->data); $i++) {
	?>
	<script type="text/javascript">
	//<![CDATA[
	  window.addEvent('domready', function(){
	    var data = {
<?php
			// loop through cards in section
			foreach ($this->data[$i] as $key => $val) {
?>
	      '<?php echo $this->Environment->base . $val['picture']; ?>': { caption: '<?php echo $val['autor']; ?>' },
<?php
}
?>
	    };
	    var myGallery_rwcards_<?php echo $i; ?> = new Slideshow('show_<?php echo $i; ?>', data, { duration: 3000, captions: true, controller: false, height: <?php echo $thumb_box_height; ?>, width: <?php echo $thumb_box_width; ?>});
	  });
	//]]>
	</script>
<table id="rwcardsTable<?php echo $i;?>" border="0">
<tr>
<td width="150px">
	<div id="rwcards_gallery">
		<div id="myGallery_rwcards_<?php echo $i; ?>">

<?php
			// loop through cards in section
			foreach ($this->data[$i] as $key => $val) {
?>
		<div id="show_<?php echo $i; ?>" class="slideshow">
			<a href="<?php echo $this->generateFrontendUrl('',  $this->alias . '/view/rwconecategory/category_id/' . $this->categories[$i]['id'] . '/reWritetoSender/' . $this->reWritetoSender . '/reWritetoSenderId/' . $this->data[$i]['id'] . '/sessionId/' . $this->sessionId. '/' . $this->alias);?>"><img src=""  alt="" /></a>
<?php
			}
?>
		</div>
	</div>
</td>

<td valign="top" style="width:200px; padding: 0px 5px;">
	<span style="font-weight: bold; text-decoration:underline;">
		<a href="<?php echo $this->generateFrontendUrl('',  $this->alias . '/view/rwconecategory/category_id/' . $this->categories[$i]['id'] . '/reWritetoSender/' . $this->reWritetoSender . '/reWritetoSenderId/' . $this->data[$i]['id'] . '/sessionId/' . $this->sessionId . '/' .  $this->alias);?>"><?php echo $this->categories[$i]['category_kategorien_name']; ?></a>
	</span>
	<br />
	<br />

	<?php echo nl2br(htmlentities( $this->categories[$i]['category_description'], ENT_QUOTES, 'UTF-8' )); ?>

	<br /><br /><br /><br />
	<a href="<?php echo $this->generateFrontendUrl('',  $this->alias . '/view/rwconecategory/category_id/' . $this->categories[$i]['id'] . '/reWritetoSender/' . $this->reWritetoSender . '/reWritetoSenderId/' . $this->data[$i]['id'] . '/sessionId/' . $this->sessionId . '/' .  $this->alias);?>"><?php echo $this->seeAllCards; ?></a>
</td>
</tr>
</table>
<?php
		}
	}
	else {
?>
<table id="rwcardsTable">
<tr>
	<td valign="top">
		<span style="font-weight: bold; color:red; font-size:14px;">
			<?php echo $this->noCategoriesPublished; ?>
		</span>
	</td>
</tr>
</table>
<?php
	}
?>

<?php echo $this->pagination; ?>